package com.sky.dto;

import com.sky.valid.AddGroup;
import com.sky.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

@Data
@ApiModel(description = "员工登录时传递的数据模型")
public class EmployeeDTO implements Serializable {

    @ApiModelProperty("员工ID")
    @Min(value = 1, message = "ID格式不正确", groups = UpdateGroup.class)
    private Long id;

    @NotBlank(groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty("员工账号")
    private String username;

    @NotBlank(groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty("员工姓名")
    private String name;

    @Pattern(regexp = "0\\\\d{2,3}[-]?\\\\d{7,8}|0\\\\d{2,3}\\\\s?\\\\d{7,8}|13[0-9]\\\\d{8}|15[1089]\\\\d{8}", message = "电话号码格式不正确", groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty("员工电话号码")
    private String phone;

    @NotBlank(groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty("员工性别")
    private String sex;

    @Pattern(regexp = "\\d{6}(18|19|20)?\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|[xX])", message = "身份证格式不正确", groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty("员工身份证")
    private String idNumber;

}
